//部分控制器
var app = angular.module('myApp.controllers');

//example首页
app.controller('searchIndex', ["$scope", "utilService", "$rootScope", "$ionicModal", function ($scope, utilService, $rootScope, $ionicModal) {

    $scope.isFocus = false;
    $scope.shopList = [
        {},
        {},
    ]
    $scope.submitData = {
        keyword:''
    }

    $scope.areList = [
        {id:'1', name:'重庆市'},
        {id:'2', name:'江北区'},
        {id:'3', name:'沙坪坝区'},
        {id:'4', name:'大渡口区'},
        {id:'5', name:'南岸区'},
        {id:'6', name:'其他区'},
        {id:'7', name:'举个例子的'},

    ]
    $scope.typeList = [
        {id:'1', name:'距离优先'},
        {id:'2', name:'好评优先'}
    ]
    // 展示地址选择
    $scope.areaModal = false;
    $scope.typeModal = false;
    $scope.showAreaModal = function () {
        $scope.areaModal = !$scope.areaModal;
        $scope.typeModal = false;
    }
    $scope.showTypeModal = function () {
        $scope.typeModal = !$scope.typeModal;
        $scope.areaModal = false;
    }
    $scope.closeModal = function () {
        $scope.areaModal = false;
        $scope.typeModal = false;
    }
    $scope.$on('$ionicView.beforeEnter', function () {
        //页面刚加载
        utilService.$ionicLoading.show(HX_CONFIG.loadingBase);
    }, false);
    $scope.$on('$ionicView.afterEnter', function () {
        utilService.$rootScope.rootData.title = '车主服务';
        //页面加载完成
        utilService.$ionicLoading.hide();
    }, false);
    $rootScope.$on('$ionicView.beforeLeave', function (e, ion) {
        //页面离开之前
        //alertPopup && alertPopup.close();

    }, false);

}]);
app.controller('searchNearby', ["$scope", "utilService", "$rootScope", "$ionicScrollDelegate", function ($scope, utilService, $rootScope, $ionicScrollDelegate) {


    $scope.$on('$ionicView.beforeEnter', function () {
        //页面刚加载
        utilService.$ionicLoading.show(HX_CONFIG.loadingBase);
    }, false);
    $scope.$on('$ionicView.afterEnter', function () {
        utilService.$rootScope.rootData.title = '车主服务';
        //页面加载完成
        utilService.$ionicLoading.hide();
    }, false);
    $rootScope.$on('$ionicView.beforeLeave', function (e, ion) {
        //页面离开之前
        //alertPopup && alertPopup.close();

    }, false);

}]);